﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DIProject.Setting
{
    public partial class SellerList : Form
    {
        private Util.IdNamePair _args;
        public SellerList(ref Util.IdNamePair arg)
        {
            _args = arg;
            InitializeComponent();
        }
        private SellerList()
        {
            InitializeComponent();
        }

        private void SellerList_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'settings.Contragents' table. You can move, or remove it, as needed.
            this.contragentsTableAdapter.Fill(this.settings.Contragents);

        }

        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            dgv.Rows[e.RowIndex].Selected = true;
            DataRowView drv = dgv.SelectedRows[0].DataBoundItem as DataRowView;
            if (drv != null)
            {
                DataSets.Settings.ContragentsRow cr = drv.Row as DataSets.Settings.ContragentsRow;
                if (cr != null)
                {
                    _args.ID = cr.Id;
                    _args.Name = cr.Name;
                }
            }
            this.Close();
        }
    }
}